<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>帐号管理</title>
	<%@ include file="/common/meta.jsp" %>
    <%@ include file="/common/public_input.jsp" %>
	<script>
		$(document).ready(function() {
			//聚焦第一个输入框
			//$("#loginName").focus();
			//为inputForm注册validate函数
			$("#inputForm").validate({
				rules: {
					loginName: {
						required: true,
                        minlength:4,
                        maxlength:30,
						remote: "check_login_name.action?oldLoginName=" + $("#oldLoginName").val()
					},
					name: "required",
					password: {
						required: true,
						minlength:3
					},
					passwordConfirm: {
						equalTo:"#password"
					},
					email:"email",
					checkedRoleIds:"required"
				},
				messages: {
					loginName: {
						remote: "用户登录名已存在"
					},
					passwordConfirm: {
						equalTo: "输入与上面相同的密码"
					}
				}
			});
		});
	</script>
</head>

<body>
<div class="div-tabs-nav">
        <ul class="ui-tabs-nav">
            <li class="ui-tabs-selected">系统用户信息</li>
        </ul>
</div>
	<%--<h2><s:if test="id == null">创建</s:if><s:else>修改</s:else>用户</h2>--%>
<div class="ui-tabs-panel">
	<form id="inputForm" action="save.action" method="post">
        <div id="message"><s:actionmessage theme="custom" cssClass="success"/></div>
        <div>系统用户<s:if test="id!=null">信息</s:if><s:else>创建</s:else></div>
		<input type="hidden" name="id" value="${id}"/>
		<input type="hidden" id="oldLoginName" name="oldLoginName" value="${loginName}"/>
		<table class="noborder">
			<tr>
				<td>登录名:</td>
				<s:if test="id == null">
				    <td>
				    <s:textfield name="loginName" id="loginName" size="40"/>
				    </td>
				</s:if><s:else>
				    <td>
				        <s:textfield name="loginName" id="loginName" size="40" readonly="true"/>
				    </td>
				    </s:else>

			</tr>
			<tr>
				<td>姓名:</td>
				<td>
                    <s:if test="admin == 0">
                        <s:textfield id="name" name="name" size="40" />
                    </s:if>
                    <s:else>
                        <s:textfield id="name" name="name" size="40" readonly="true"/>
                    </s:else>
                </td>
			</tr>
			<s:if test="admin == 1 || (admin == 0 && id==null)">
			<tr>
				<td>密码:</td>
				<td><input type="password" id="password" name="password" size="40" value=""/></td>
			</tr>
			<tr>
				<td>确认密码:</td>
				<td><input type="password" id="passwordConfirm" name="passwordConfirm" size="40" value=""/>
				</td>
			</tr>
			</s:if>
			<tr>
                <td>状态</td>
                <td><s:select name="enabled" list="#this.enabledMap"/></TD>
            </tr>
			<tr>
				<td>邮箱:</td>
				<td><s:textfield id="email" name="email" size="40" /></td>
			</tr>
            <tr>
				<td>手机:</td>
				<td><s:textfield id="phone" name="phone" size="40" /></td>
			</tr>
            <tr>
				<td>描述:</td>
				<td><textarea rows="3" cols="40" name="description" id="describe">${description}</textarea></td>
			</tr>
			<security:authorize ifAnyGranted="AUTH_MANAGER_AUTH,AUTH_ALL">
			<tr>
				<td>角色:</td>
				<td>
					<s:checkboxlist name="checkedRoleIds" list="allRoleList" listKey="id" listValue="name" theme="custom"/>
				</td>
			</tr>
            <tr>
                <td>权限:</td>
                <td>
                    <s:checkboxlist name="checkedAuthIds" list="allAuthList" listKey="id"
                                    listValue="description" theme="custom"/>
                    <s:checkbox name="checkedAuthIds" value="true" fieldValue="2"  onclick="return false;"/>浏览权限
                </td>
            </tr>
			</security:authorize>
		</table>
         <div align="left">
                <input class="button" type="submit" value="提交"/>&nbsp;
                <input type="reset" class="input-button" value="重置"/>
          </div>
	</form>
</div>
</body>
</html>

